package com.cus.tom.transfer.frag;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.cus.tom.transfer.App;
import com.cus.tom.transfer.bean.MediaData;
import com.cus.tom.transfer.utils.Read;

import java.util.List;
import java.util.Set;

public class AudioFragment extends ImgFragment {

    public AudioFragment(int type, int index) {
        super(type, index);
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = super.onCreateView(inflater, container, savedInstanceState);
        binding.includeToolbar.back.setText("全部音频");
        return view;
    }

    @Override
    protected Set<String> getOldData() {
        return audio;
    }

    @Override
    protected void recordSelect() {
        audio.clear();
        List<MediaData> list = adapter.getSelect();
        for (MediaData item : list) {
            audio.add(item.getPath());
        }
    }

    @Override
    protected List<MediaData> getMediaData() {
        return new Read().loadAudio(App.getApp(), page, Integer.MAX_VALUE);
    }
}
